package part14_迭代器模式_统一遍历问题;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @ClassName: InfoCollege
 * @Author: AllenSun
 * @Date: 2020/3/8 14:07
 */
public class InfoCollege implements Colleage {

    List<Department> departmentList;

    public InfoCollege() {
        departmentList=new ArrayList<Department>();
        addDepartment("信息安全","信息安全专业");
        addDepartment("网络安全","网络安全专业");
        addDepartment("数据挖掘","数据挖掘专业");
    }

    @Override
    public String getName() {
        return "信息工程学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department=new Department(name,desc);
        departmentList.add(department);
    }

    @Override
    public Iterator createIterator() {
        return new InfoColleageIterator(departmentList);
    }
}
